package com.tiamo.traders.controller;

import com.tiamo.traders.entity.Mail;
import com.tiamo.traders.utils.MailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.core.EmitUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MailController {


    @RequestMapping("/sendMail")
    @ResponseBody
    public String sendMail(Mail mail){

        boolean isEmil = MailUtils.sendMail(mail.getRecipients(),mail.getTitle(),mail.getText());
        if (isEmil){
            return "success";
        }else {
            return "error";
        }
    }
}
